@echo off


for /f "delims=*" %%a in ('dir /b /s *.ipynb') do (
  echo %%a
  if exist "%%~dpna.py" del "%%a"
  if exist "%%~dpna.txt" del "%%a"
  if exist "%%a" (
  jupyter nbconvert --to script "%%a"
  if exist "%%~dpna.py" del "%%a"
  if exist "%%~dpna.txt" del "%%a"
  )
)
